﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OnLineExam.BLL;
using System.Data;

namespace OnLineExam.Web.mag
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var ds = HHG.DBUtility.DbHelperSQL.Query("select * from UserAnswer where paperid=24 and  type='单选题'");
            //var ds = bll.GetAllList();
            List<HHG.DBUtility.CommandInfo> list = new List<HHG.DBUtility.CommandInfo>();
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                //获取正确答案
                int usermark = SingleSelectedManager.ChkAnswer(row["titleid"].ToString(), row["useranswer"].ToString()) ? Convert.ToInt32(row["mark"].ToString()) : 0;

                var ss = "update UserAnswer set usermark=" + usermark + " where type='单选题' and paperid=24";
                list.Add(new HHG.DBUtility.CommandInfo(ss, null));
            }
            HHG.DBUtility.DbHelperSQL.ExecuteSqlTran(list);
        }
    }
}